package com.example.app.common;

import lombok.Getter;

@Getter
public enum Role {
    User(0),
    Admin(1);

    private final int value;

    Role(int value) {
        this.value = value;
    }

    public static Role getRoleByValue(Integer value) {
        if (value == null) {
            return null;
        }
        Role[] values = Role.values();
        for (Role role : values) {
            if (role.value == value) {
                return role;
            }
        }
        return null;
    }
}
